package com.weight.system.overload.service.impl;

import com.weight.system.overload.PO.OverloadInfo;
import com.weight.system.overload.service.OverloadInfoService;
import com.weight.system.overload.DAO.OverloadInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 超重记录表
 */
@Service
@Transactional
@Slf4j
public class OverloadInfoServiceImpl implements OverloadInfoService {

	@Autowired
	private OverloadInfoMapper overloadInfoMapper;


	/**
	 * 查询超重记录信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<OverloadInfo> findOverloadInfoByT(Map map){
		return overloadInfoMapper.findOverloadInfoByT(map);
	}

	/**
	 * 查询超重记录信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<OverloadInfo> findOverloadInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<OverloadInfo> overloadInfoList = overloadInfoMapper.findOverloadInfoByT(map);
		return overloadInfoList;
	}

	/**
	 * 查询超重记录信息--查询全部
	 * @return
	 */
	@Override
	public List<OverloadInfo> findAll(){
		return overloadInfoMapper.findAll();
	}

	/**
	 * ID查询超重记录信息
	 * @param map
	 * @return
	 */
	@Override
	public OverloadInfo findByOverloadInfoId(Map map){
		OverloadInfo overloadInfo=overloadInfoMapper.findByOverloadInfoId(map);
		CommonUtils.validateExistObj(overloadInfo,map);
		return overloadInfo;
	}

	/**
	 * ID查询超重记录信息-批量
	 * @param overloadInfoIdList
	 * @return
	 */
	@Override
	public List findByOverloadInfoIdList(List overloadInfoIdList){
		List idList = overloadInfoMapper.findByOverloadInfoIdList(overloadInfoIdList);
		CommonUtils.validateExistList(idList,overloadInfoIdList);
		return idList;
	}

	/**
	 * 添加超重记录
	 * @param overloadInfo
	 */
	@Override
	public void insertOverloadInfo(OverloadInfo overloadInfo){
		overloadInfoMapper.insertOverloadInfo(overloadInfo);
	}

	/**
	 * 批量添加超重记录
	 * @param overloadInfoList
	 */
	@Override
	public void insertOverloadInfoBatch(List<OverloadInfo> overloadInfoList){
		overloadInfoMapper.insertOverloadInfoBatch(overloadInfoList);
	}

	/**
	 * 修改超重记录
	 * @param overloadInfo
	 */
	@Override
	public void updateOverloadInfo(OverloadInfo overloadInfo){
		overloadInfoMapper.updateOverloadInfo(overloadInfo);
	}

	/**
	 * 修改超重记录
	 * @param overloadInfo
	 */
	@Override
	public void updateOverloadInfoLimt(OverloadInfo overloadInfo){
		overloadInfoMapper.updateOverloadInfoLimt(overloadInfo);
	}

	/**
	 * 物理删除超重记录
	 * @param map
	 */
	@Override
	public void deleteByOverloadInfoId(Map map){
		overloadInfoMapper.deleteByOverloadInfoId(map);
	}

	/**
	 * 批量物理删除超重记录
	 * @param overloadInfoIdList
	 */
	@Override
	public void deleteByOverloadInfoIdBatch(List overloadInfoIdList){
		overloadInfoMapper.deleteByOverloadInfoIdBatch(overloadInfoIdList);
	}

	/**
	 * 状态删除超重记录
	 * @param map
	 */
	@Override
	public void upDelByOverloadInfoId(Map map){
		overloadInfoMapper.upDelByOverloadInfoId(map);
	}

	/**
	 * 批量状态删除超重记录
	 * @param overloadInfoList
	 */
	@Override
	public void upDelByOverloadInfoIdBatch(Map<String, Object> map){
		overloadInfoMapper.upDelByOverloadInfoIdBatch(map);
	}

}